package cn.heyige.backend.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.List;

@Data
public class SensitiveWordDto {
    
    @Setter
    @Getter
    public static class CheckResult {
        private String originalText;
        private String processedText;
        private Boolean hasSensitiveWord = false;
        private Boolean isRejected = false;
        private String rejectReason;
        private List<MatchedWord> matchedWords;
    }

    @Setter
    @Getter
    public static class MatchedWord {
        private String word;
        private String category;
    }

    @Setter
    @Getter
    public static class AddRequest {
        @NotBlank(message = "敏感词不能为空")
        @Size(max = 100, message = "敏感词长度不能超过100")
        private String word;
        
        @Size(max = 50, message = "分类长度不能超过50")
        private String category = "默认";
        
        @NotNull(message = "级别不能为空")
        private Integer level = 1;
        
        @Size(max = 100, message = "替换文本长度不能超过100")
        private String replacement = "***";
    }
    
    @Setter
    @Getter
    public static class UpdateRequest {
        @NotBlank(message = "敏感词不能为空")
        @Size(max = 100, message = "敏感词长度不能超过100")
        private String word;
        
        @Size(max = 50, message = "分类长度不能超过50")
        private String category;
        
        @Size(max = 100, message = "替换文本长度不能超过100")
        private String replacement;
    }
    
    @Setter
    @Getter
    public static class ImportRequest {
        @NotNull(message = "敏感词列表不能为空")
        private List<String> words;
        
        @Size(max = 50, message = "分类长度不能超过50")
        private String category = "默认";

        @Size(max = 100, message = "替换文本长度不能超过100")
        private String replacement = "***";
    }
    
    @Setter
    @Getter
    public static class ImportResult {
        private Integer totalCount = 0;
        private Integer successCount = 0;
        private Integer failureCount = 0;
        private List<String> failureReasons;
    }
    
    @Setter
    @Getter
    public static class SensitiveWordResponse {
        private Integer id;
        private String word;
        private String category;
        private String replacement;
        private Boolean isActive;
        private LocalDateTime createdAt;
        private LocalDateTime updatedAt;
    }
}